package com.penghaonan.appframework.utils

import org.json.JSONArray
import org.json.JSONObject

class JSONUtils {

}

fun <T> JSONArray.toList(): List<T> {
    return toMutableList()
}

fun <T> JSONArray.toMutableList(): MutableList<T> {
    val list = mutableListOf<T>()
    for (i in 0..<this.length()) {
        val item: T = this.opt(i) as T
        list.add(item)
    }
    return list
}